package name.shareview;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class InitShareView extends Activity implements OnClickListener {
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(getSharedPreferences("ShareView", MODE_WORLD_READABLE).contains(ShareView.NAME_KEY))
        {
        	Intent i = new Intent(this, ShareView.class);
        	startActivity(i);
        }
        else
        {
        	setContentView(R.layout.init);
        	
        	Button b = (Button) findViewById(R.id.button1);
        	b.setOnClickListener(this);
        }
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.getId() == R.id.button1)
		{
			ShareView.myName = ((EditText)findViewById(R.id.nameText)).getText().toString();
			Intent i = new Intent(this, ShareView.class);
        	startActivity(i);
		}
	}
        

}
